//
//  BaseTabBarController.m
//  MusicPaly
//
//  Created by lanou on 15/8/31.
//  Copyright (c) 2015年 朱鸿儒. All rights reserved.
//

#import "BaseTabBarController.h"
#import "DiscoverViewController.h"
#import "RecemmendTableViewController.h"
#import "FindTableViewController.h"
#import "MineTableViewController.h"
#import "SaleTableViewController.h"

#import "DeckLeftRecommendViewController.h"
@interface BaseTabBarController ()

@end

@implementation BaseTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
	
    MineTableViewController *mineVC = [[MineTableViewController alloc]init];
    RecemmendTableViewController *recemmendVC = [[RecemmendTableViewController alloc]initWithStyle:(UITableViewStylePlain)];
    FindTableViewController *findVC = [[FindTableViewController alloc]initWithStyle:(UITableViewStylePlain)];
    DiscoverViewController *discoverVC = [[DiscoverViewController alloc]init];
    
    SaleTableViewController *saleVC = [[SaleTableViewController alloc]init];
    IIViewDeckController *deckVC = [[IIViewDeckController alloc]initWithCenterViewController:findVC leftViewController:saleVC];
    deckVC.leftSize = 105;
    
    DeckLeftRecommendViewController *deckRVC = [[DeckLeftRecommendViewController alloc] init];
    //  抽屉
    IIViewDeckController *aDeckVC = [[IIViewDeckController alloc] initWithCenterViewController:recemmendVC leftViewController:deckRVC];
<<<<<<< HEAD

    aDeckVC.leftSize = 300;
=======
    aDeckVC.leftSize = kWidth * 3/4;
>>>>>>> 8eaefe430df4b99be693831cedf1bcae2cb051ea
    
    
    [self addChildVC:aDeckVC title:@"推荐" imageName:@"rec" seleectedImage:@"rec"];

    [self addChildVC:discoverVC title:@"发现" imageName:@"dis" seleectedImage:@"dis"];
    
    [self addChildVC:deckVC title:@"找车" imageName:@"car" seleectedImage:@"car"];
    [self addChildVC:mineVC title:@"我" imageName:@"me" seleectedImage:@"me"];
    
}
- (void)addChildVC:(UIViewController *)childVC title:(NSString *)title imageName:(NSString *)imageName seleectedImage:(NSString *)seleectedImage{
    //设置选中图片
    childVC.tabBarItem.image = [UIImage imageNamed:imageName];
    childVC.tabBarItem.selectedImage = [UIImage imageNamed:seleectedImage];
	childVC.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    //设置导航控制器
    UINavigationController *childNVC = [[UINavigationController alloc]initWithRootViewController:childVC];

    childNVC.navigationItem.title = title;
    childNVC.tabBarItem.title = title;
	
    //将我们设置好的视图控制器添加到tabbarController
    [self addChildViewController:childNVC];
}




@end
